package net.monare.mifss.evn;

import com.vaadin.ui.UI;
import net.monare.mifss.MifssAdminMainUI;
import net.monare.mifss.MifssHolder;
import org.springframework.security.core.context.SecurityContext;

public class BasicMifssListener {

    // retrieve current user name
    protected String getUserName() {
        SecurityContext securityContext = ((MifssAdminMainUI) UI.getCurrent()).getSecurityContext();
        return securityContext.getAuthentication().getName();
    }

    protected MifssHolder getMifssHolder() {
        MifssHolder mifssHolder = ((MifssAdminMainUI) UI.getCurrent()).getMifssHolder();
        return mifssHolder;
    }
}
